
package com.xauto.pioneer.appuser.adapter;

import android.app.Activity;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.xauto.pioneer.appuser.MyApplication;
import com.xauto.pioneer.appuser.R;
import com.xauto.pioneer.appuser.model.ParkingSite;
import com.yongchun.library.model.LocalMedia;

/**
 *
 */
public class ImageSelectAdapter extends AbsAdapter<LocalMedia> {

    public ImageSelectAdapter(Activity context, int layout) {
        super(context, layout);
    }

    @Override
    public ViewHolder<LocalMedia> getHolder() {
        return new TemplateViewHolder();
    }


    private class TemplateViewHolder implements ViewHolder<LocalMedia> {

        private ImageView item_grida_image;

        @Override
        public void initViews(View v, int position) {
            item_grida_image = (ImageView) v.findViewById(R.id.item_grida_image);

        }

        @Override
        public void updateData(LocalMedia localMedia, int position) {
            if (position == getCount()-1){
                item_grida_image.setImageResource(R.mipmap.icon_unselected_photo);
            }else {
               MyApplication.getDefaultFinalBitmap(context).display(item_grida_image,localMedia.getPath());
            }
        }

        @Override
        public void doOthers(LocalMedia localMedia, int position) {

        }
    }
}
